import { SecondCareerDescData } from "../items/SecondCareerDescData";
import { LoaderHelp } from "../../../../common/display/LoaderHelp";
import { ResFileConst } from "../../../resource/ResFileConst";
import { ObjCreate } from "../../common/ObjCreate";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { ECareer } from "../../../../../Message/Public/ECareer";
import { GTextFiled } from "../../../../../com/mui/controls/GTextFiled";
//class SecondCareerDesc
    
    export  class SecondCareerDesc /* flash.display.Sprite */
    {
        constructor()
        {
            
            this.initView();
            return;
        }

        public updateView(arg1: SecondCareerDescData): void
        {
            this._data = arg1;
            LoaderHelp.addResCallBack(ResFileConst.careerImg, this.onResLoaded);
            LoaderHelp.setBitmapdata(this.getCareerImgURL(), this._careerImg);
            this._txtDesc.htmlText = this._data.desc;
            return;
        }

        /* internal  */initView(): void
        {
            ObjCreate.createBg(0, 0, 187, 320, this);
            this._careerName = new Object /* flash.display.Bitmap */();
            this._careerName.x = 76;
            this._careerName.y = 5;
            this.addChild(this._careerName);
            this._careerImg = new Object /* flash.display.Bitmap */();
            this._careerImg.x = 1;
            this._careerImg.y = 29;
            this.addChild(this._careerImg);
            this._txtDesc = ObjCreate.createGTextField("", 7, 219, 200, 120, this);
            var loc1=this._txtDesc.defaultTextFormat;
            loc1.leading = 6;
            loc1.color = 65280;
            this._txtDesc.defaultTextFormat = loc1;
            this._txtDesc.multiline = true;
            this._txtDesc.wordWrap = true;
            return;
        }

        /* internal  */onResLoaded(): void
        {
            this._careerName.bitmapData = GlobalClass.getBitmapData(this.getCareerNameImg());
            return;
        }

        /* internal  */getCareerImgURL(): string
        {
            var loc1=this._data.careerId;
            switch (loc1) 
            {
                case ECareer._ECareerWarriorD:
                {
                    return "SecondCareerTaskBg_W.jpg";
                }
                case ECareer._ECareerStabber:
                {
                    return "SecondCareerTaskBg_Y.jpg";
                }
                case ECareer._ECareerIceMage:
                {
                    return "SecondCareerTaskBg_F.jpg";
                }
                case ECareer._ECareerPriest:
                {
                    return "SecondCareerTaskBg_T.jpg";
                }
            }
            return "SecondCareerTaskBg_W.jpg";
        }

        /* internal  */getCareerNameImg(): string
        {
            return "CareerImg_" + this._data.careerId.toString();
        }

        /* internal */ /* var */_careerImg: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_careerName: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_txtDesc: GTextFiled;

        /* internal */ /* var */_data: SecondCareerDescData;
    }
